<div id="view-content">
	<div id="posts" class="backend-item posts">
	<br>
	<h2 class="backend-h2"><span class="img"></span>
		<span class="btAdd">Thông tin bài viết
        	<a href="<?php echo $this->baseUrl('/admin/post/add/');?>">Thêm bài viết mới</a>
        </span>
    </h2>
    <p class="saporator"><br /></p>
    
    <form action="" method="get">
        <p class="search_box">
            <input class="sbt hover focus" type="text" name="search_box_text" title="Nhập vào tiêu đề bài viết cần tìm"/>
            <input class="sbc input-hover" type="submit" name="search_box_sumit"  value="Tìm"/>
        </p><!-- End .search_box-->
         <p class="saporator sf"><br /></p>
         
        <div class="table_nav">
                <div class="table_nav_left">
                    <select id="tbn_cat" name="tbn_cate">
                        <option value="0" selected="selected">Hiển thị tất cả</option>
                    <?php 
                    	foreach ($this->menu2s as $menu2) {
                    		if(isset($_REQUEST['menu2Id']) && $_REQUEST['menu2Id'] == $menu2['menu2Id']){
                    			echo '<option selected value ="'.$menu2['menu2Id'].'">'.$menu2['tenMenu2'].'</option>';	
                    		}else
                    			echo '<option value ="'.$menu2['menu2Id'].'">'.$menu2['tenMenu2'].'</option>';
                    	}
                    ?>                 
                    </select>
                    
                    <input type="submit" value="Lọc" name="tbn_filter" class="tbn_button input-hover"/> <!-- tbn: là viết tắt của từ table_nav trong div class="table_nav" -->
                    <input type="submit" value="Xóa" name="cmdDel" class="tbn_button input-hover"/>
                </div><!-- end .table_nav_left -->
                <div class="table_nav_pages">  
                <?php 
                	echo $this->paginationControl($this->paginatorPosts,'sliding','paginator.phtml');
                		
                ?>
                </div>
            </div><!-- End .table_nav-->
        <table id="p_post">
            <thead>
                <tr>
                    <th class="col-1-post"><input class="check-all" type="checkbox" /></th>
                    <th class="col-2-post">Tiều đề</th>
                    <th class="col-3-post">Nội dung</th>
                    <th class="col-4-post">Ngày đăng</th>
                    <th class="col-5-post">Mục</th>
                    <th class="col-6-post">Trạng thái</th>
                </tr>
            </thead>
            <tbody>
            <?php 
            	foreach ($this->paginatorPosts as $post){
//            		echo "<pre>";
//            		print_r($post);
            		$status = ($post['trangThai'] == 1) ? "Đã đăng" : "Chưa đăng";
            		if($post['thungRac'] == 1) continue;
            ?>    
                <tr>
                    <th class="col-1-post">
                        <input class="sub-check" name="post-check[]" type="checkbox" value="<?php echo $post['baiVietId'];?>"/>
                    </th>
                    <th class="col-2-post post_title">
                    	<strong><a href="" class="title_ct"><?php echo $post['tieuDe'];?></a></strong> 
	                    <div class="row_action">
	                        <span class="row_edit">
	                        	<a href="<?php echo $this->baseUrl('/admin/post/add/?edit&post='.$post['baiVietId']);?>">Sửa</a>|
	                        </span>
	                        <span class="row_trash">
	                        	<a href="<?php echo $this->baseUrl('/admin/post/delete/?trash&post='.$post['baiVietId']);?>">Cho vào thùng rác</a>|
	                        </span>
	                        <span class="row_del">
	                        	<a href="<?php echo $this->baseUrl('/admin/post/delete/?delete&post='.$post['baiVietId']);?>">Xóa</a>
	                        </span>                        
	                    </div>
                    </th>
                    <th class="col-3-post"><?php echo $this->truncate($post['noiDung'],0,150);?> </th>
                    
                    <th class="col-4-post"><?php echo $post['ngayViet']; ?></th>
                    <th class="col-5-post"><?php echo $post['tenMenu2']; ?></th>
                    <th class="col-6-post post_title">
                        <strong><a href="" class="title_ct"><?php echo $status;?></a></strong> 
	                    <div class="row_action">
	                        <span class="row_edit">
	                        	<a href="<?php echo $this->baseUrl('/admin/post/publish/?up&post='.$post['baiVietId']);?>">Đăng bài</a>|
	                        </span>
	                        <span class="row_trash">
	                        	<a href="<?php echo $this->baseUrl('/admin/post/publish/?down&post='.$post['baiVietId']);?>">Không đăng</a>
	                        </span>
	                    </div>
                    </th>
                </tr>                                          
            <?php 
            	}
            ?>             
            </tbody>
            <tfoot>
                <tr>
                    <th class="col-1-post"><input class="check-all" type="checkbox" /></th>
                    <th class="col-2-post">Tiều đề</th>
                    <th class="col-3-post">Nội dung</th>
                    <th class="col-4-post">Ngày đăng</th>
                    <th class="col-5-post">Mục</th>
                    <th class="col-6-post">Trạng thái</th>             
                </tr>
            </tfoot>
        </table>
                
    </form>
</div><!-- end #posts -->
	
</div>